parallel |
您所在的位置:网站首页 › missing man pages of some commands › parallel |
Building the command line
The command The command can be a script, a binary or a Bash function if the function is exported using export -f: # Works only in Bash my_func() { echo in my_func "$1" } export -f my_func parallel my_func ::: 1 2 3If the command is complex, it often improves readability to make it into a function. The replacement strings GNU parallel has some replacement strings to make it easier to refer to the input read from the input sources. If the input is mydir/mysubdir/myfile.myext then: {} = mydir/mysubdir/myfile.myext {.} = mydir/mysubdir/myfile {/} = myfile.myext {//} = mydir/mysubdir {/.} = myfile {#} = the sequence number of the job {%} = the job slot numberWhen a job is started it gets a sequence number that starts at 1 and increases by 1 for each new job. The job also gets assigned a slot number. This number is from 1 to the number of jobs running in parallel. It is unique between the running jobs, but is re-used as soon as a job finishes. The positional replacement strings The replacement strings have corresponding positional replacement strings. If the value from the 3rd input source is mydir/mysubdir/myfile.myext: {3} = mydir/mysubdir/myfile.myext {3.} = mydir/mysubdir/myfile {3/} = myfile.myext {3//} = mydir/mysubdir {3/.} = myfileSo the number of the input source is simply prepended inside the {}'s. |
CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3 |